package cm.hyb.Controller;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttributes;

import cm.hyb.Controller.model.Employee;
import cm.hyb.mapper.EmployeeMapper;
import cm.hyb.service.EmployeeService;

@RestController
@RequestMapping("employee")
@SessionAttributes(names="employee")
public class EmployeeController {

	
	@Resource
	private EmployeeService employeeService ;
	
	
	@Resource
	private EmployeeMapper EmployeeMapper;   //测试用
	@GetMapping("byId")
	public Object findById(int id) {
		return EmployeeMapper.finById(id);
	}
	
	@GetMapping("all")
	@ResponseBody
	public Employee finAll(){
		return employeeService.finAll();
	}
	
	@GetMapping("alls")
	public String finAlls(Map<String, Object> map){
		map.put("employee", employeeService.finAlls());
		return "em/allEmployee";
	}
	
	@GetMapping("delete")
	public Boolean delete(Map<String, Object> map) {
		return delete(map);
	}
	
}
